import { createRouter, createWebHistory } from 'vue-router'
import routes from './routes'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes,
})

// 导航守卫
router.beforeEach((to, from) => {
  if (to.matched.length == 0) {
    router.push({ name: '404' })
    return
  }
})
export default router
